package cn.edu.hstc.wm.adapter;

import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
 * @ClassName: MainPagerAdapter
 * @Description: 主界面的ViewPager的适配器
 * 
 * @ModificationHistory
 */
public class MainPagerAdapter extends FragmentPagerAdapter {
	/*
	 * 加入显示的Fragment
	 */
	List<Fragment> listFragments;
	String[] titles;

	public MainPagerAdapter(FragmentManager fm) {
		super(fm);
	}

	public MainPagerAdapter(FragmentManager fm, List<Fragment> list) {
		super(fm);
		this.listFragments = list;
	}

	public MainPagerAdapter(FragmentManager fm, List<Fragment> list, String[] titles) {
		super(fm);
		this.listFragments = list;
		this.titles = titles;
	}

	@Override
	public Fragment getItem(int paramInt) {
		Fragment fragment = listFragments.get(paramInt);
		// Bundle bundle = new Bundle();
		// bundle.putString("key", "value");
		// fragment.setArguments(bundle);
		return fragment;
	}

	@Override
	public int getCount() {
		return listFragments.size();
	}

	@Override
	public CharSequence getPageTitle(int position) {
		// Tab上显示的标题
		return titles[position];
	}

}
